using System.Windows.Controls;

namespace FrontDisplay
{
    internal class FadeoutAnimation : IAnimation
    {
        public void Initialize(Control control)
        {
            control.Opacity = 0;
        }

        public bool NextStep(Control oldControl, Control newControl)
        {
            double opacity = oldControl.Opacity - Animation.AnimationStep;
            if (opacity <= 0)
            {
                opacity = 0;
            }

            oldControl.Opacity = opacity;
            newControl.Opacity = 1 - opacity;

            return (opacity > 0);
        }
    }
}